// ScanDialog
// $Id: ScanDialog.java,v 1.7 2003/02/03 19:07:06 axelwernicke Exp $
//
// Copyright (C) 2002-2003 Axel Wernicke <axel.wernicke@gmx.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
package de.axelwernicke.mypod.gui;

import de.axelwernicke.mypod.SwingWorker;


/**
 *
 * @author  axel wernicke
 */
public class ScanDialog extends javax.swing.JDialog {
    private SwingWorker worker = null;

    /** Creates new form ScanDialog */
    public ScanDialog(SwingWorker worker, java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.worker = worker;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    private void initComponents() //GEN-BEGIN:initComponents
     {
        java.awt.GridBagConstraints gridBagConstraints;

        statusLabel = new javax.swing.JLabel();
        statusContentLabel = new javax.swing.JLabel();
        totalProgressBar = new javax.swing.JProgressBar();
        fileNameLabel = new javax.swing.JLabel();
        fileNameContentLabel = new javax.swing.JLabel();
        clipsAddedLabel = new javax.swing.JLabel();
        clipsAddedContentLabel = new javax.swing.JLabel();
        clipsUpdatedLabel = new javax.swing.JLabel();
        clipsUpdatedContentLabel = new javax.swing.JLabel();
        cancelButton = new javax.swing.JButton();

        getContentPane().setLayout(new java.awt.GridBagLayout());

        setTitle(GuiUtils.getStringLocalized("resource/language", "scanningFiles"));
        setName("scanDialog");
        setResizable(false);
        addWindowListener(new java.awt.event.WindowAdapter() {
                public void windowClosing(java.awt.event.WindowEvent evt) {
                    closeDialog(evt);
                }
            });

        statusLabel.setForeground(new java.awt.Color(102, 102, 153));
        statusLabel.setText(GuiUtils.getStringLocalized("resource/language", "status:"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 12, 0, 0);
        getContentPane().add(statusLabel, gridBagConstraints);

        statusContentLabel.setFont(new java.awt.Font("Dialog", 1, 10));
        statusContentLabel.setMaximumSize(new java.awt.Dimension(250, 14));
        statusContentLabel.setMinimumSize(new java.awt.Dimension(250, 14));
        statusContentLabel.setPreferredSize(new java.awt.Dimension(250, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(12, 11, 0, 12);
        getContentPane().add(statusContentLabel, gridBagConstraints);

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 1;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.insets = new java.awt.Insets(11, 17, 0, 17);
        getContentPane().add(totalProgressBar, gridBagConstraints);

        fileNameLabel.setForeground(new java.awt.Color(102, 102, 153));
        fileNameLabel.setText(GuiUtils.getStringLocalized("resource/language", "filename:"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(11, 12, 0, 0);
        getContentPane().add(fileNameLabel, gridBagConstraints);

        fileNameContentLabel.setFont(new java.awt.Font("Dialog", 1, 10));
        fileNameContentLabel.setMaximumSize(new java.awt.Dimension(250, 14));
        fileNameContentLabel.setMinimumSize(new java.awt.Dimension(250, 14));
        fileNameContentLabel.setPreferredSize(new java.awt.Dimension(250, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 2;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(11, 11, 0, 12);
        getContentPane().add(fileNameContentLabel, gridBagConstraints);

        clipsAddedLabel.setForeground(new java.awt.Color(102, 102, 153));
        clipsAddedLabel.setText(GuiUtils.getStringLocalized("resource/language", "clipsAdded:"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(11, 12, 0, 0);
        getContentPane().add(clipsAddedLabel, gridBagConstraints);

        clipsAddedContentLabel.setFont(new java.awt.Font("Dialog", 1, 10));
        clipsAddedContentLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        clipsAddedContentLabel.setMaximumSize(new java.awt.Dimension(75, 14));
        clipsAddedContentLabel.setMinimumSize(new java.awt.Dimension(75, 14));
        clipsAddedContentLabel.setPreferredSize(new java.awt.Dimension(75, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 3;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(11, 11, 0, 0);
        getContentPane().add(clipsAddedContentLabel, gridBagConstraints);

        clipsUpdatedLabel.setForeground(new java.awt.Color(102, 102, 153));
        clipsUpdatedLabel.setText(GuiUtils.getStringLocalized("resource/language", "clipsUpdated:"));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.gridwidth = 2;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 12, 0, 0);
        getContentPane().add(clipsUpdatedLabel, gridBagConstraints);

        clipsUpdatedContentLabel.setFont(new java.awt.Font("Dialog", 1, 10));
        clipsUpdatedContentLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        clipsUpdatedContentLabel.setMaximumSize(new java.awt.Dimension(75, 14));
        clipsUpdatedContentLabel.setMinimumSize(new java.awt.Dimension(75, 14));
        clipsUpdatedContentLabel.setPreferredSize(new java.awt.Dimension(75, 14));
        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 2;
        gridBagConstraints.gridy = 4;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
        gridBagConstraints.insets = new java.awt.Insets(5, 11, 0, 0);
        getContentPane().add(clipsUpdatedContentLabel, gridBagConstraints);

        cancelButton.setText(GuiUtils.getStringLocalized("resource/language", "cancel"));
        cancelButton.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    cancelButtonActionPerformed(evt);
                }
            });

        gridBagConstraints = new java.awt.GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.gridy = 5;
        gridBagConstraints.gridwidth = 3;
        gridBagConstraints.insets = new java.awt.Insets(17, 0, 12, 0);
        getContentPane().add(cancelButton, gridBagConstraints);

        pack();
    } //GEN-END:initComponents

    private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) //GEN-FIRST:event_cancelButtonActionPerformed
     { //GEN-HEADEREND:event_cancelButtonActionPerformed
        if (worker != null) {
            worker.interrupt();
        }
    } //GEN-LAST:event_cancelButtonActionPerformed

    /** Closes the dialog */
    private void closeDialog(java.awt.event.WindowEvent evt) { //GEN-FIRST:event_closeDialog
        if (worker != null) {
            worker.interrupt();
        }
    } //GEN-LAST:event_closeDialog

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel fileNameLabel;
    public javax.swing.JLabel clipsUpdatedContentLabel;
    private javax.swing.JLabel statusLabel;
    public javax.swing.JProgressBar totalProgressBar;
    public javax.swing.JLabel statusContentLabel;
    private javax.swing.JLabel clipsUpdatedLabel;
    public javax.swing.JButton cancelButton;
    public javax.swing.JLabel clipsAddedContentLabel;
    private javax.swing.JLabel clipsAddedLabel;
    public javax.swing.JLabel fileNameContentLabel;

    // End of variables declaration//GEN-END:variables
}
